/** 
 *  @file       encoder.c
 *  @brief      译码器驱动函数
 *  @author     Z B T   
 *  @version    V0.1
 *  @date       2015-10
 */
 
#include "digitron.h"
#include "encoder.h"
#include "keypad.h"
#include "delay.h"
#include "config.h"
    
sbit LSA = P2^2;
sbit LSB = P2^3;
sbit LSC = P2^4;


/**
 *  译码器输出选择
 *  @param [in]选择译码器输出值作为位选信号
 *  @return None
 */
void encoder_select(unsigned char i)
{
	switch (i)
	{
	case 0:
		LSA = 0;
		LSB = 0;
		LSC = 0;
		break;
	case 1:
		LSA = 1;
		LSB = 0;
		LSC = 0;
		break;
	case 2:
		LSA = 0;
		LSB = 1;
		LSC = 0;
		break;
	case 3:
		LSA = 1;
		LSB = 1;
		LSC = 0;
		break;
	case 4:
		LSA = 0;
		LSB = 0;
		LSC = 1;
		break;
	case 5:
		LSA = 1;
		LSB = 0;
		LSC = 1;
		break;
	case 6:
		LSA = 0;
		LSB = 1;
		LSC = 1;
		break;
	case 7:
		LSA = 1;
		LSB = 1;
		LSC = 1;
		break;
	default: 
		break;
	}
}